import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;
import java.net.*;

public class Riddle implements MouseListener
{

    public Image image;
    public Image line;
    
    public int x;
    public int y;
    
    public boolean outline;
    public AudioClip clip;

    public Riddle (int xPos, int yPos)
    {
        x = xPos;
        y = yPos;
    
        outline = false;
        ImageIcon pic = new ImageIcon(getClass().getResource("./riddler.png"));
        ImageIcon selectlight = new ImageIcon(getClass().getResource("./riddlerout.png"));
        
        Class metaObject = this.getClass();
        URL url = metaObject.getResource("riddler.au");
        
        clip = Applet.newAudioClip(url);
        
        image = pic.getImage();
        line = selectlight.getImage();
    }
    
    public void paint(Graphics g)
    {
        g.drawImage(image, x, y, null);
        if (outline)
            g.drawImage(line, x, y, null);
    }
    
    public void mousePressed(MouseEvent e)
    {
        if (e.getX() >= x && e.getX() <= x + 27 && e.getY() >= y && e.getY() <= y + 43)
        {
            clip.play();
        }
        else
        {
            outline = true;
        }
        
    }
    public void mouseReleased(MouseEvent e){
        outline = false; 
    }
    public void mouseClicked(MouseEvent e){}
    public void mouseEntered(MouseEvent e){
            
    }
    public void mouseExited(MouseEvent e){
                
    }

}
